/**
 * 
 */
package tarena.netctoss.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import tarena.netctoss.dao.OperationDao;
import tarena.netctoss.po.Module;
import tarena.netctoss.po.Operation;

/**
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-3-11
 */

public class OperationDaoImpl implements OperationDao {

	private HibernateTemplate hibernateTemplate;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * tarena.netctoss.dao.OperationDao#delete(tarena.netctoss.po.Operation)
	 */
	@Override
	public void delete(Operation operation) {
		hibernateTemplate.delete(operation);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.dao.OperationDao#findAll()
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Operation> findAll() {
		return hibernateTemplate.find("from Operation order by name");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.dao.OperationDao#findById(java.lang.Integer)
	 */
	@Override
	public Operation findById(Integer id) {
		return (Operation) hibernateTemplate.get(Module.class, id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tarena.netctoss.dao.OperationDao#save(tarena.netctoss.po.Operation)
	 */
	@Override
	public void save(Operation operation) {
		hibernateTemplate.save(operation);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * tarena.netctoss.dao.OperationDao#update(tarena.netctoss.po.Operation)
	 */
	@Override
	public void update(Operation operation) {
		hibernateTemplate.update(operation);

	}

	/**
	 * 依赖入住
	 * 
	 * @param hibernateTemplate
	 */
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

}
